#ifndef _FTPPOOL_HPP
#define _FTPPOOL_HPP

#include "ftpenv.hpp"
#include <string>
#include <curl/curl.h>
#include <semaphore.h>

namespace com_oocl_riley
{

typedef CURL Connection;
class FtpPool
{
public:
    FtpPool(const std::string& host,const std::string& port="",const std::string& usr="",const std::string& pwd="",unsigned int maxCon=10);
    ~FtpPool();
    Connection *getConnection();
    void releaseConnection(Connection *con);
    std::string Host()
    {
        return _host;
    }
    std::string Port()
    {
        return _port;
    }
    std::string Usr()
    {
        return _usr;
    }
    std::string Pwd()
    {
        return _pwd;
    }
private:
    FtpEnv *_ftpEnv;
    std::string _host;
    std::string _port;
    std::string _usr;
    std::string _pwd;
    unsigned int _maxCon;
private:
    sem_t _sem;
};
}

#endif // _FTPPOOL_HPP
